//
//  UIEventEx.h
//  STM
//
//  Created by  xuchen(陈旭)， xichen(陈曦)， qq：511272827 on 10-10-22.
//  Copyright 2010 cc_team.com. All rights reserved.
//
#ifndef	CC_UI_EVENT
#define	CC_UI_EVENT

#include "CCAll.h"

#ifdef	OBJC_MACRO
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

// 事件
#define	MSG_CLICK		UIControlEventTouchUpInside
#define	MSG_CLICKDOWN	UIControlEventTouchDown

//触摸函数宏
#define	TOUCH_BEGIN		- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
#define	FUNC_END		}

#define	TOUCH_MOVED		- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

#define	TOUCH_ENDED		- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

#define	IS_SINGLE_TOUCH(touch)	(1 == [touch tapCount])
#define	IS_DOUBLE_TOUCH(touch)	(2 == [touch tapCount])

//避免将双击事件的第一个单击当成单独的事件: not availble now
//#define	CANCEL_PREV_TOUCH(target)	[NSObject cancelPreviousPerformRequestsWithTarget:target] 

#ifdef	__cplusplus
extern "C" {
#endif

	// 获取触摸的view
	UIView *getTouchView(const NSSet *touches);
	
#ifdef	__cplusplus
}
#endif
		
@interface UIEventEx : UIEvent
{

}

//获取触摸所在位置的坐标，如： x为20, y为45
+ (CGPoint)getTouchPoint:(UIView *)view withEvent:(UIEvent *)event;

@end
#endif

#endif